﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Graphing.Model;
using System.Collections.ObjectModel;

namespace Graphing.Services
{
    public class PlotPtsService
    {
        #region Fields

        ObservableCollection<Point> PointsList = GenericSingleton<ObservableCollection<Point>>.GetInstance();

        #endregion // Fields.

        #region Properties

        public Scale graphScale { get; set; }

        #endregion // Properties.

        #region Convert

        public List<Point> Convert()
        {
            List<Point> convertedList = new List<Point>();
            
            foreach(Point i in PointsList)
            {
                Point temp = i;
                temp.x *= graphScale.converterX;
                temp.y *= graphScale.converterY;

                convertedList.Add(temp);
            }
            return convertedList;
        }
        
        #endregion // Convert.

        #region Sort

        public List<Point> Sort(List<Point> pointList)
        {
            pointList.Sort();

            return pointList;
        }

        #endregion // Sort.
    }
}
